package com.huike.business.service.impl;


import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.mapper.TbBusinessTrackRecordMapper;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商机跟进记录Service业务层处理
 *
 * @author wgl
 * @date 2021-04-28
 */
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {

    @Autowired
    private TbBusinessTrackRecordMapper trackRecordMapper;

    /**
     * 增加商机的记录表
     * 增加记录的同时可能修改商机的基本信息
     *
     * @param businessTrackVo
     */
    @Override
    public void add(BusinessTrackVo businessTrackVo) {
        businessTrackVo.setCreateBy(SecurityUtils.getUsername());
        //增加商机记录
        trackRecordMapper.add(businessTrackVo);

        //修改商机记录
        trackRecordMapper.update(businessTrackVo);
    }

    @Override
    public List<BusinessTrackVo> selectAll(Long id) {
        List<BusinessTrackVo> list =trackRecordMapper.selectAll(id);
        return list;
    }
}
